function [out,c] = target(x)
    global Ns dmax vmax tDelaymax Tcharge Tmax
    [~,delays,ts,~,~,~] = general(x);
    T=sum(ts,2)/vmax;
    out=sum(ceil(Tcharge./T)+1);
    c=sum(T>Tmax);
    tDelay=sum(delays,'all')/(vmax*Ns);
    c=c+(tDelay>tDelaymax)+sum(sum(ts,2)>dmax);
end